package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.ProductUnitService;
import com.atguigu.spzx.model.pojo.product.ProductUnit;
import com.atguigu.spzx.model.vo.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dyl
 * @version 1.0
 * @description:
 * @date 2025/1/13 16:07
 */
@RestController
@RequestMapping("/admin/product/unit")
@Tag(name = "产品单元管理")
@CrossOrigin(allowCredentials = "true", originPatterns = "*", allowedHeaders = "*")
public class ProductUnitController {
    @Autowired
    private ProductUnitService productUnitService;

    @GetMapping("/findAll")
    @Operation(summary = "获取单元列表")
    public Result<List<ProductUnit>> findAll() {
        List<ProductUnit> productUnits = productUnitService.list();
        return Result.ok(productUnits);
    }

}
